import { nextInt } from "./nextInt"

/**
 * Returns a random hexadecimal string
 */
const _hexChars = '0123456789abcdef'
const _hexCharsLength = _hexChars.length

export function randHex(size = 1): string {
  let str = ''
  while (size-- > 0) {
    str += _hexChars[nextInt(_hexCharsLength)]
  }
  return str
}
